home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Patches.h
-
- Contains: Patch Manager Interfaces.
-
- Version: Technology: System 8
- Release: Universal Interfaces 3.0d3 on Copland DR1
-
- Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
-
- Bugs?: If you find a problem with this file, send the file and version
- information (from above) and the problem description to:
-
- Internet: apple.bugs@applelink.apple.com
- AppleLink: APPLE.BUGS
-
- */
- #ifndef __PATCHES__
- #define __PATCHES__
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
- #ifndef __KERNEL__
- #include <Kernel.h>
- #endif
- #ifndef __ORDEREDITEMS__
- #include <OrderedItems.h>
- #endif
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #if PRAGMA_IMPORT_SUPPORTED
- #pragma import on
- #endif
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=mac68k
- #endif
-
- #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
-
- enum {
- kOSTrapType = 0,
- kToolboxTrapType = 1
- };
-
- typedef SignedByte TrapType;
-
- enum {
- OSTrap = kOSTrapType, /* old name */
- ToolTrap = kToolboxTrapType /* old name */
- };
-
- /*
- GetTrapAddress and SetTrapAddress are obsolete and should not
- be used. Always use NGetTrapAddress and NSetTrapAddress instead.
- The old routines will not be supported for PowerPC apps.
- */
- #if OLDROUTINENAMES && !GENERATINGCFM
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __A0 GetTrapAddress(__D0)
- #endif
- extern pascal UniversalProcPtr GetTrapAddress(UInt16 trapNum)
- ONEWORDINLINE(0xA146);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter SetTrapAddress(__A0, __D0)
- #endif
- extern pascal void SetTrapAddress(UniversalProcPtr trapAddr, UInt16 trapNum)
- ONEWORDINLINE(0xA047);
-
- #endif
- extern pascal UniversalProcPtr NGetTrapAddress(UInt16 trapNum, TrapType tTyp);
-
- extern pascal void NSetTrapAddress(UniversalProcPtr trapAddr, UInt16 trapNum, TrapType tTyp);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __A0 GetOSTrapAddress(__D0)
- #endif
- extern pascal UniversalProcPtr GetOSTrapAddress(UInt16 trapNum)
- ONEWORDINLINE(0xA346);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter SetOSTrapAddress(__A0, __D0)
- #endif
- extern pascal void SetOSTrapAddress(UniversalProcPtr trapAddr, UInt16 trapNum)
- ONEWORDINLINE(0xA247);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __A0 GetToolTrapAddress(__D0)
- #endif
- extern pascal UniversalProcPtr GetToolTrapAddress(UInt16 trapNum)
- ONEWORDINLINE(0xA746);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter SetToolTrapAddress(__A0, __D0)
- #endif
- extern pascal void SetToolTrapAddress(UniversalProcPtr trapAddr, UInt16 trapNum)
- ONEWORDINLINE(0xA647);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __A0 GetToolboxTrapAddress(__D0)
- #endif
- extern pascal UniversalProcPtr GetToolboxTrapAddress(UInt16 trapNum)
- ONEWORDINLINE(0xA746);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter SetToolboxTrapAddress(__A0, __D0)
- #endif
- extern pascal void SetToolboxTrapAddress(UniversalProcPtr trapAddr, UInt16 trapNum)
- ONEWORDINLINE(0xA647);
-
- #if GENERATINGPOWERPC
- extern pascal UniversalProcHandle GetTrapVector(UInt16 trapNumber);
-
- #endif
- /*
-
- // Moved here from StdCLib
- pascal Boolean TrapAvailable (UInt16 trapNumber);
-
- */
- #endif
- /* FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED*/
- #if FOR_SYSTEM8_PREEMPTIVE
- typedef struct OpaquePatchID* PatchID;
- typedef struct OpaquePatchChainID* PatchChainID;
- typedef void *PatchableProcPtr;
- typedef OptionBits PatchOptions;
-
- enum {
- kPatchEnabledBit = 0,
- kPatchCompatibilityBit = 1,
- kPatchOptionalBit = 2
- };
-
-
- enum {
- kPatchEnabledMask = (1L << kPatchEnabledBit),
- kPatchCompatibilityMask = (1L << kPatchCompatibilityBit),
- kPatchOptionalMask = (1L << kPatchOptionalBit)
- };
-
- typedef OrderedItemName PatchName;
- typedef PatchName *PatchNamePtr;
- typedef OrderRequirements PatchOrderRequirements;
- typedef PatchOrderRequirements *PatchOrderRequirementsPtr;
- struct PatchDescription {
- PatchableProcPtr originalRoutine; /* A normal (probably imported) proc ptr.*/
- PatchableProcPtr patchRoutine; /* A normal (probably imported) proc ptr.*/
- PatchName thisPatchName;
- PatchOrderRequirements thisPatchOrdering;
- PatchOptions installOptions;
- OSStatus installResult;
- PatchID thisPatchID; /* Set if installed OK.*/
- PatchableProcPtr thisCallThroughProc; /* Set if installed OK.*/
- PatchID rejectingPatchID; /* Set if there was an installation error.*/
- };
- typedef struct PatchDescription PatchDescription;
-
- typedef PatchDescription *PatchDescriptionPtr;
- #define InitialPatchDescription(originalProc,patchProc,patchName,patchOrder,installOptions) \
- {originalProc, patchProc, patchName, patchOrder, installOptions, paramErr, kInvalidID, NULL, kInvalidID}
- typedef OptionBits PatchHeaderOptions;
-
- enum {
- kRequiredPatchErrorsMask = 0x00000001, /* Any installation errors in required patches?*/
- kOptionalPatchErrorsMask = 0x00000002 /* Any installation errors in optional patches?*/
- };
-
-
- enum {
- kPatchHeaderTag = 'Ptch',
- kPatchHeaderVersion = 1
- };
-
- struct PatchHeader {
- OSType tag; /* Must be 'Ptch'.*/
- UInt32 version; /* The data structure version.*/
- PatchHeaderOptions flags; /* Set by CFM with install status.*/
- ItemCount count; /* The total size of the "patches" array.*/
- PatchDescriptionPtr * patches; /* Pointer to description array.*/
- };
- typedef struct PatchHeader PatchHeader;
-
-
- enum {
- kPatchInformationVersion = 1
- };
-
- struct PatchInformation {
- PatchChainID patchChain;
- PatchableProcPtr patchingRoutine;
- PatchOptions patchOptions;
- PatchName patchName;
- PatchOrderRequirements patchOrder;
- };
- typedef struct PatchInformation PatchInformation;
-
- typedef PatchInformation *PatchInformationPtr;
-
- enum {
- kPatchChainInformationVersion = 1
- };
-
- struct PatchChainInformation {
- KernelProcessID kernelProcess;
- PatchableProcPtr chainRoot;
- };
- typedef struct PatchChainInformation PatchChainInformation;
-
- typedef PatchChainInformation *PatchChainInformationPtr;
- /*
- * Maps a ProcPtr to a PatchChainID.
- * If the ProcPtr is a patch, return noErr and Chain
- * If the ProcPtr is a root, return noErr and Chain
- * If the ProcPtr is not a patch or a root, return an error
- */
- extern OSStatus GetPatchChainFromProcPtr(KernelProcessID theKernelProcess, PatchableProcPtr theRoutine, PatchChainID *thePatchChain);
-
- /*
- * Maps a ProcPtr to a PatchID.
- * If the ProcPtr is a patch, return noErr and the PatchID
- * If the ProcPtr is a root, return notAPatchErr
- * If the ProcPtr is not a patch or a root, return notAPatchErr
- */
- extern OSStatus GetPatchFromProcPtr(KernelProcessID theKernelProcess, PatchableProcPtr theRoutine, PatchID *thePatch);
-
- extern OSStatus GetPatchChainInformation(PatchChainID thePatchChain, PBVersion version, PatchChainInformation *patchChainInfo);
-
- extern OSStatus GetPatchInformation(PatchID thePatchID, PBVersion version, PatchInformation *patchInfo);
-
- /*
- * Iteration functions:
- * Get all the chains in a KernelProcess, and
- * Get all the patches in a chain
- */
- extern OSStatus GetPatchChainsInKernelProcess(KernelProcessID theKernelProcess, ItemCount requestedPatchChains, ItemCount *totalPatchChains, PatchChainID *thePatchChains);
-
- extern OSStatus GetPatchesInPatchChain(PatchChainID thePatchChain, ItemCount requestedPatches, ItemCount *totalPatches, PatchID *thePatches);
-
- extern OSStatus EnablePatch(PatchID thePatch);
-
- extern OSStatus DisablePatch(PatchID thePatch);
-
- #endif
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=reset
- #endif
-
- #if PRAGMA_IMPORT_SUPPORTED
- #pragma import off
- #endif
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /* __PATCHES__ */
-
-